//
//  ViewController.swift
//  WNLockDemo
//
//  Created by 裴威 on 30/08/2018.
//  Copyright © 2018 wunu. All rights reserved.
//

import UIKit
import SwiftyJSON
import PKHUD

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    @IBAction func handlePushToAppEvent(_ sender: UIButton) {
        /**************************************************
         1.蓝牙相关操作在类BLEFacade中；其中BLEConfigure用来配置锁的UUID
         2.网络接口操作请查看Network/Api下的接口文件;
         3.采用swift4.0+开发，如果要接入到OC工程中，需要用swift4.0+将网络库和请求接口封装一下(block形式返回，因为OC不支持枚举关联)；
         比如如下的login接口，若用到OC项目中，需要封装成诸如SharedInstance.shared.login(paramaters: [string: any]).success(info: [string: any]).failure(NSError)或者其他形式
         **************************************************/
        ProfileApi.login(phone: "18018711017", password: "123123").execute { result in
            switch result {
            case .success(let json):
                print(json)
                let vc = UIStoryboard(name: "WNLockUI", bundle: nil).instantiateViewController(withIdentifier: "LockListViewController")
                self.navigationController?.pushViewController(vc, animated: true)
            case .failure(let error):
                HUD.flash(.label((error as NSError).domain), delay: 1.5)
            }
        }
        
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

